<html>
<head>
<title>简历后台</title>

<style type="text/css">
 
 .t_border,.t_border td 
 {
  	border:1px solid grey;
  }
  
  table
    {
        border-collapse: collapse;
        border: none;
        width: 100%;
    }
    td,th
    {
        border: solid #000 1px;
    }
</style>
<script src="http://assets.dajieimg.com/lib/jquerymobile/jquery-1.11.0.min.56456.js"></script>
<script type="text/javascript">
	
	var genResume =function(id)
	{
		//alert(id);
		$.ajax({
				url:'/admin/resume/genresume',
				type:'POST',
				data:{id:id},
				dataType:'text',
				timeout: 5000,
				error:function(){	alert("error");},
				success:function(res){
					//alert("res:"+res);
					window.open("http://t.dajie.com/file/download?filename="+res);
				}
			});
	}

	var checkDownload = function(uid)
	{
		var uids = $("#downloadUids").val();
		$("#downloadUids").val(uids+"_"+uid);
	}
	
	var downloadAll = function()
	{
		var ids = "0";
		$('input[type="checkbox"][name="downloadUid"]:checked').each
			(
                function() 
                {
                       ids += ","+$(this).val();
                }
            );
		if(ids == "0")
		{
			return ;
		}
		
		
		$.ajax({
				url:'/admin/resume/genresumeall',
				type:'POST',
				data:{ids:ids},
				dataType:'text',
				timeout: 50000,
				error:function(){	alert("error");},
				success:function(res){
					//alert("res:"+res);
					window.open("http://t.dajie.com/file/downloadall?filename="+res);
				}
			});
	}

	var checkallf = function (obj)
	{
		if(obj.checked == true)
		{
			$('input[type="checkbox"][name="downloadUid"]').each
			(
                function() 
                {
                       $(this).attr("checked",true);
                       this.checked=true;
                }
            );
		}else
		{
			$('input[type="checkbox"][name="downloadUid"]').each
			(
                function() 
                {
                       $(this).attr("checked",false);
                       this.checked=false;
                }
            );
		}
	}
	
	
	var getAttr = function(id)
	{
		$.ajax({
				url:'/admin/resume/getattr',
				type:'POST',
				data:{ids:id},
				dataType:'text',
				timeout: 50000,
				error:function()
					{	
						alert("error");
					},
				success:function(res)
				{
					//alert("res:"+res);
					if(res != "error")
					{
						window.open("http://t.dajie.com/file/downloadbyfilename?filename="+res);
					}else
					{
						alert("网络错误!");
					}
				}
			});
	}
</script>
</head>
 	
<body>
<form id="search" action="/admin/resume/showlist">
	<#--状态：<select id="status" name="status" >
			<option value="0" selected >全部</option>
			<option value="1" <#if status?? && status == 1>selected</#if> >查看邀约</option>
			<option value="2" <#if status?? && status == 2>selected</#if> >接受邀约</option>
			<option value="3" <#if status?? && status == 3>selected</#if> >拒绝邀约</option>
		</select>
	 手机：<input type="text" id="mobile" name="mobile" value="${mobile!""}" />-->
	职位ID：<input type="text" id="jid" name="jid" value="${jid!""}" style="width:300px"/>
	
	<input type="submit" id="submit" name="submit" value="submit"/>
</form>

<div id="download_div" style="text-align:right">
	<input type="button" value="批量下载" onclick="downloadAll()"/>		&nbsp;&nbsp;&nbsp;&nbsp;
	<input type="hidden" value="" id="downloadUids" name="downloadUids" />	
</div>

<div width="100%">
    <table>
        <colgroup>
            <col width="120">
            <col width="120">
            <col width="120">
            <col width="120">
            <col width="120">
            <col width="120">
            <col width="120">
            <col width="120">
            <col width="120">
            <col width="120">
            <col width="120">
            <col width="120">
            <col width="80">
        </colgroup>
        <tbody >
        	<tr>
            	<th>更新时间</th>
            	<th>姓名</th>
            	<th>性别</th>
            	<th>出生年月</th>
            	<th>居住地</th>
            	<th>所在公司</th>
            	<th>工作年限</th>
            	<th>手机</th>
            	<th>邮箱</th>
            	<th>户口</th>
            	<th>附件简历</th>
            	<th>生成简历</th>
            	<th>下载全部<input type="checkbox" id="all" name="all" value="all" onClick="checkallf(this)"/></th>
        	</tr>
        	<#list list as data >
	            <tr>
	                <td>${data.updateDate?string("yyyy-MM-dd")}</td>
	                <td>${data.basicInfo.name!""}</td>
	                <td><#if data.basicInfo.gender?? && data.basicInfo.gender ==1>男<#elseif data.basicInfo.gender?? && data.basicInfo.gender ==2>女</#if></td>
	                <td><#if data.basicInfo.birthday??>${data.basicInfo.birthday?string("yyyy-MM-dd")}</#if></td>
	                <td>${data.basicInfo.livecity!}</td>
	                <td>${data.defaultPracticeInfo.corpName!""}</td>
	                <td>${data.basicInfo.workYears!""}</td>
	                <td>${data.mobile!""}</td>
	                <td>${data.email!""}</td>
	                <td>${data.demicile!""}</td>
	                <td><#if data.resumeFile?? && data.resumeFile!=""><a href="javascript:void(0)" onClick="getAttr(${data.id})">下载附件</a></#if></td>
	            	<td><a href="javascript:void(0)" onClick="genResume(${data.id})">生成简历</a></td>
	            	<td><input type="checkbox" id="${data.id}" name="downloadUid" value="${data.id}" onClick="checkDownload(this.value)"/></td>
	            </tr>
	         </#list>
        </tbody>
   </table>
</div>
